<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QTextBlockFormat Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QTextBlockFormat Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTextBlockFormat class provides formatting information for
blocks of text in a <a href="qtextdocument.html">QTextDocument</a>.
<a href="#details">More...</a></p>

<p>Inherits <a href="qtextformat.html">QTextFormat</a>.</p><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtextblockformat.html#QTextBlockFormat">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#QTextBlockFormat-2">__init__</a></b> (<i>self</i>, QTextBlockFormat)</li><li><div class="fn" />Qt.Alignment <b><a href="qtextblockformat.html#alignment">alignment</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextblockformat.html#bottomMargin">bottomMargin</a></b> (<i>self</i>)</li><li><div class="fn" />int <b><a href="qtextblockformat.html#indent">indent</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextblockformat.html#isValid">isValid</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextblockformat.html#leftMargin">leftMargin</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtextblockformat.html#nonBreakableLines">nonBreakableLines</a></b> (<i>self</i>)</li><li><div class="fn" />QTextFormat.PageBreakFlags <b><a href="qtextblockformat.html#pageBreakPolicy">pageBreakPolicy</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextblockformat.html#rightMargin">rightMargin</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setAlignment">setAlignment</a></b> (<i>self</i>, Qt.Alignment&#160;<i>aalignment</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a></b> (<i>self</i>, float&#160;<i>margin</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setIndent">setIndent</a></b> (<i>self</i>, int&#160;<i>aindent</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a></b> (<i>self</i>, float&#160;<i>margin</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setNonBreakableLines">setNonBreakableLines</a></b> (<i>self</i>, bool&#160;<i>b</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setPageBreakPolicy">setPageBreakPolicy</a></b> (<i>self</i>, QTextFormat.PageBreakFlags&#160;<i>flags</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setRightMargin">setRightMargin</a></b> (<i>self</i>, float&#160;<i>margin</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setTabPositions">setTabPositions</a></b> (<i>self</i>, list-of-QTextOption.Tab&#160;<i>tabs</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setTextIndent">setTextIndent</a></b> (<i>self</i>, float&#160;<i>margin</i>)</li><li><div class="fn" /><b><a href="qtextblockformat.html#setTopMargin">setTopMargin</a></b> (<i>self</i>, float&#160;<i>margin</i>)</li><li><div class="fn" />list-of-QTextOption.Tab <b><a href="qtextblockformat.html#tabPositions">tabPositions</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextblockformat.html#textIndent">textIndent</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtextblockformat.html#topMargin">topMargin</a></b> (<i>self</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QTextBlockFormat class provides formatting information for
blocks of text in a <a href="qtextdocument.html">QTextDocument</a>.</p>
<p>A document is composed of a list of blocks, represented by
<a href="qtextblock.html">QTextBlock</a> objects. Each block can
contain an item of some kind, such as a paragraph of text, a table,
a list, or an image. Every block has an associated QTextBlockFormat
that specifies its characteristics.</p>
<p>To cater for left-to-right and right-to-left languages you can
set a block's direction with setDirection(). Paragraph alignment is
set with <a href="qtextblockformat.html#setAlignment">setAlignment</a>(). Margins
are controlled by <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(), <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>(),
<a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(),
<a href="qtextblockformat.html#setRightMargin">setRightMargin</a>().
Overall indentation is set with <a href="qtextblockformat.html#setIndent">setIndent</a>(), the indentation
of the first line with <a href="qtextblockformat.html#setTextIndent">setTextIndent</a>().</p>
<p>Line spacing is set with <a href="qtextblockformat.html#setLineHeight">setLineHeight</a>() and
retrieved via <a href="qtextblockformat.html#lineHeight">lineHeight</a>() and <a href="qtextblockformat.html#lineHeightType">lineHeightType</a>(). The
types of line spacing available are in the <a href="qtextblockformat.html#LineHeightTypes-enum">LineHeightTypes</a>
enum.</p>
<p>Line breaking can be enabled and disabled with <a href="qtextblockformat.html#setNonBreakableLines">setNonBreakableLines</a>().</p>
<p>The brush used to paint the paragraph's background is set with
<a href="qtextformat.html#setBackground">setBackground()</a>, and
other aspects of the text's appearance can be customized by using
the <a href="qtextformat.html#setProperty">setProperty()</a>
function with the <tt>OutlinePen</tt>, <tt>ForegroundBrush</tt>,
and <tt>BackgroundBrush</tt> <a href="qtextformat.html#Property-enum">QTextFormat.Property</a>
values.</p>
<p>If a text block is part of a list, it can also have a list
format that is accessible with the listFormat() function.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTextBlockFormat" />QTextBlockFormat.__init__ (<i>self</i>)</h3><p>Constructs a new <a href="qtextblockformat.html">QTextBlockFormat</a>.</p>


<h3 class="fn"><a name="QTextBlockFormat-2" />QTextBlockFormat.__init__ (<i>self</i>, <a href="qtextblockformat.html">QTextBlockFormat</a>)</h3><h3 class="fn"><a name="alignment" /><a href="qt-alignment.html">Qt.Alignment</a> QTextBlockFormat.alignment (<i>self</i>)</h3><p>Returns the paragraph's alignment.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setAlignment">setAlignment</a>().</p>


<h3 class="fn"><a name="bottomMargin" />float QTextBlockFormat.bottomMargin (<i>self</i>)</h3><p>Returns the paragraph's bottom margin.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>() and
<a href="qtextblockformat.html#topMargin">topMargin</a>().</p>


<h3 class="fn"><a name="indent" />int QTextBlockFormat.indent (<i>self</i>)</h3><p>Returns the paragraph's indent.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setIndent">setIndent</a>().</p>


<h3 class="fn"><a name="isValid" />bool QTextBlockFormat.isValid (<i>self</i>)</h3><p>Returns true if this block format is valid; otherwise returns
false.</p>


<h3 class="fn"><a name="leftMargin" />float QTextBlockFormat.leftMargin (<i>self</i>)</h3><p>Returns the paragraph's left margin.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), <a href="qtextblockformat.html#rightMargin">rightMargin</a>(), and <a href="qtextblockformat.html#indent">indent</a>().</p>


<h3 class="fn"><a name="nonBreakableLines" />bool QTextBlockFormat.nonBreakableLines (<i>self</i>)</h3><p>Returns true if the lines in the paragraph are non-breakable;
otherwise returns false.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setNonBreakableLines">setNonBreakableLines</a>().</p>


<h3 class="fn"><a name="pageBreakPolicy" /><a href="qtextformat-pagebreakflags.html">QTextFormat.PageBreakFlags</a> QTextBlockFormat.pageBreakPolicy (<i>self</i>)</h3><p>Returns the currently set page break policy for the paragraph.
The default is <a href="qtextformat.html#PageBreakFlag-enum">QTextFormat.PageBreak_Auto</a>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setPageBreakPolicy">setPageBreakPolicy</a>().</p>


<h3 class="fn"><a name="rightMargin" />float QTextBlockFormat.rightMargin (<i>self</i>)</h3><p>Returns the paragraph's right margin.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>() and
<a href="qtextblockformat.html#leftMargin">leftMargin</a>().</p>


<h3 class="fn"><a name="setAlignment" />QTextBlockFormat.setAlignment (<i>self</i>, <a href="qt-alignment.html">Qt.Alignment</a>&#160;<i>aalignment</i>)</h3><p>Sets the paragraph's <i>alignment</i>.</p>
<p><b>See also</b> <a href="qtextblockformat.html#alignment">alignment</a>().</p>


<h3 class="fn"><a name="setBottomMargin" />QTextBlockFormat.setBottomMargin (<i>self</i>, float&#160;<i>margin</i>)</h3><p>Sets the paragraph's bottom <i>margin</i>.</p>
<p><b>See also</b> <a href="qtextblockformat.html#bottomMargin">bottomMargin</a>(), <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(), <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), and
<a href="qtextblockformat.html#setRightMargin">setRightMargin</a>().</p>


<h3 class="fn"><a name="setIndent" />QTextBlockFormat.setIndent (<i>self</i>, int&#160;<i>aindent</i>)</h3><p>Sets the paragraph's <i>indentation</i>. Margins are set
independently of indentation with <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>() and
<a href="qtextblockformat.html#setTextIndent">setTextIndent</a>().
The <i>indentation</i> is an integer that is multiplied with the
document-wide standard indent, resulting in the actual indent of
the paragraph.</p>
<p><b>See also</b> <a href="qtextblockformat.html#indent">indent</a>() and <a href="qtextdocument.html#indentWidth-prop">QTextDocument.indentWidth</a>().</p>


<h3 class="fn"><a name="setLeftMargin" />QTextBlockFormat.setLeftMargin (<i>self</i>, float&#160;<i>margin</i>)</h3><p>Sets the paragraph's left <i>margin</i>. Indentation can be
applied separately with <a href="qtextblockformat.html#setIndent">setIndent</a>().</p>
<p><b>See also</b> <a href="qtextblockformat.html#leftMargin">leftMargin</a>(), <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>(),
<a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(),
and <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>().</p>


<h3 class="fn"><a name="setNonBreakableLines" />QTextBlockFormat.setNonBreakableLines (<i>self</i>, bool&#160;<i>b</i>)</h3><p>If <i>b</i> is true, the lines in the paragraph are treated as
non-breakable; otherwise they are breakable.</p>
<p><b>See also</b> <a href="qtextblockformat.html#nonBreakableLines">nonBreakableLines</a>().</p>


<h3 class="fn"><a name="setPageBreakPolicy" />QTextBlockFormat.setPageBreakPolicy (<i>self</i>, <a href="qtextformat-pagebreakflags.html">QTextFormat.PageBreakFlags</a>&#160;<i>flags</i>)</h3><p>Sets the page break policy for the paragraph to
<i>policy</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p><b>See also</b> <a href="qtextblockformat.html#pageBreakPolicy">pageBreakPolicy</a>().</p>


<h3 class="fn"><a name="setRightMargin" />QTextBlockFormat.setRightMargin (<i>self</i>, float&#160;<i>margin</i>)</h3><p>Sets the paragraph's right <i>margin</i>.</p>
<p><b>See also</b> <a href="qtextblockformat.html#rightMargin">rightMargin</a>(), <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(), and
<a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>().</p>


<h3 class="fn"><a name="setTabPositions" />QTextBlockFormat.setTabPositions (<i>self</i>, list-of-QTextOption.Tab&#160;<i>tabs</i>)</h3><p>Sets the tab positions for the text block to those specified by
<i>tabs</i>.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qtextblockformat.html#tabPositions">tabPositions</a>().</p>


<h3 class="fn"><a name="setTextIndent" />QTextBlockFormat.setTextIndent (<i>self</i>, float&#160;<i>margin</i>)</h3><p>Sets the <i>indent</i> for the first line in the block. This
allows the first line of a paragraph to be indented differently to
the other lines, enhancing the readability of the text.</p>
<p><b>See also</b> <a href="qtextblockformat.html#textIndent">textIndent</a>(), <a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(), <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>(),
<a href="qtextblockformat.html#setTopMargin">setTopMargin</a>(),
and <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>().</p>


<h3 class="fn"><a name="setTopMargin" />QTextBlockFormat.setTopMargin (<i>self</i>, float&#160;<i>margin</i>)</h3><p>Sets the paragraph's top <i>margin</i>.</p>
<p><b>See also</b> <a href="qtextblockformat.html#topMargin">topMargin</a>(), <a href="qtextblockformat.html#setBottomMargin">setBottomMargin</a>(),
<a href="qtextblockformat.html#setLeftMargin">setLeftMargin</a>(),
and <a href="qtextblockformat.html#setRightMargin">setRightMargin</a>().</p>


<h3 class="fn"><a name="tabPositions" />list-of-QTextOption.Tab QTextBlockFormat.tabPositions (<i>self</i>)</h3><p>Returns a list of tab positions defined for the text block.</p>
<p>This function was introduced in Qt 4.4.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setTabPositions">setTabPositions</a>().</p>


<h3 class="fn"><a name="textIndent" />float QTextBlockFormat.textIndent (<i>self</i>)</h3><p>Returns the paragraph's text indent.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setTextIndent">setTextIndent</a>().</p>


<h3 class="fn"><a name="topMargin" />float QTextBlockFormat.topMargin (<i>self</i>)</h3><p>Returns the paragraph's top margin.</p>
<p><b>See also</b> <a href="qtextblockformat.html#setTopMargin">setTopMargin</a>() and
<a href="qtextblockformat.html#bottomMargin">bottomMargin</a>().</p>
<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.9.1 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2011</td><td align="right" width="25%">Qt&#160;4.8.0</td></tr></table></div></address></body></html>